<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>

 <BODY>
 <h1>分类博客</h1>

 <a href="${pageContext.request.contextPath}/admin">返回管理</a>
  <br/>
 <table width="662" height="82" border="1">
    <tr>
      <td >标题</td>
      <td>发表时间</td>
      <td>分类</td>
      <td>浏览</td>
      <td>评论</td>
      <td>管理</td>
    </tr>
   <c:forEach items="${catg.includeArticles}" var="article" begin="${startIndex}" end="${endIndex}">
   <tr>
      <td><a href="${pageContext.request.contextPath}/admin/blogs/${article.id }">${article.title}</a><br></td>
      <td>${article.postTime}</td>
      <td>${article.category.name}</td>
      <td>123</td>
      <td>123</td>
      <td><a href="${pageContext.request.contextPath}/admin/blogs/${article.id }/edit">编辑 </a>&nbsp;
      <a href="${pageContext.request.contextPath}/admin/blogs/${article.id }" onclick="if (confirm('你确定要删除这篇博客？')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', 'method'); m.setAttribute('value', 'delete'); f.appendChild(m);f.submit(); };return false;" title="删除"
      >删除</a><br></td>
    </tr>
   </c:forEach>
 </table>
        <!-- 页码导航 -->
          <c:if test="${pages>1}">
          <div class='Nav'>
          <span>Pages (${pages}):</span>
          <c:if test="${nav[0]!=0}">
          <a href="${pageContext.request.contextPath}/admin/categories/${catg.id }/?page=${nav[0]}"><strong>&laquo;</strong></a>
          </c:if>
          <!-- 设置导航数组长度 -->
         <c:set var="navlen" value="${fn:length(nav)}"></c:set>
         <c:forEach items="${nav}" var="lab" begin="1" end="${navlen-2}" step="1">
         	
         	<c:if test="${lab!=0}">
         		<c:choose>
         			<c:when test="${curPage==lab}">
         			 <strong class='on'>${curPage}</strong> 
         			</c:when>
         			<c:otherwise>
         			<a href="${pageContext.request.contextPath}/admin/categories/${catg.id }/?page=${lab}">${lab }</a> 
         			</c:otherwise>
         		</c:choose>
         	</c:if>
         </c:forEach>
         
       		 <c:if test="${nav[navlen-1]!=0}">
          <a href="${pageContext.request.contextPath}/admin/categories/${catg.id }/?page=${nav[navlen-1]}"><strong>&raquo;</strong></a>
          </c:if>
           </div>
            </c:if>
             <!-- 导航结束 -->
 </BODY>
</HTML>
